﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Demo</title>
    <link href="/Scripts/JQuery_zTree_v3.3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"
        type="text/css" />
    <link href="/Scripts/JQuery_zTree_v3.3/css/ctrldemo.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/Scripts/Ctrls/Ctrl.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="/Scripts/JQuery_zTree_v3.3/js/jquery.ztree.core-3.3.js" type="text/javascript"></script>
    <script src="/Scripts/JQuery_zTree_v3.3/js/jquery.ztree.excheck-3.3.min.js" type="text/javascript"></script>
    <script src="../jquery.form.js" type="text/javascript"></script>
    <script src="../jquery.data.js" type="text/javascript"></script>
    <script type="text/javascript" src="jquery.AutoComplete.js?version=1.01"></script>
    <script src="jQuery.DataQuery.js" type="text/javascript"></script>
    <script src="jQuery.DataTotal.js" type="text/javascript"></script>
    <script src="jquery.OrgPostEmpData.js" type="text/javascript"></script>
    <script src="/Scripts/Ctrls/jquery.DeptSelect.js" type="text/javascript"></script>
    <script src="/Scripts/Ctrls/jquery.OrgData.js" type="text/javascript"></script>
    <script src="/Scripts/Ctrls/jquery.OrgPostEmpData.js" type="text/javascript"></script>
    <script src="/Scripts/Ctrls/jquery.TreesSelect.js?v=0.1" type="text/javascript"></script>
    <script src="/Scripts/Ctrls/jquery.MultiPostSelect.js" type="text/javascript"></script>
    <script src="/Scripts/ctrls/jquery.UserSelect.js" type="text/javascript"></script>
    <script src="/Scripts/ctrls/jquery.MultiUserSelect.js" type="text/javascript"></script>
    <script src="jquery.Commbox.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="/Scripts/jquery-easyui-1.3.6/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="/Scripts/jquery-easyui-1.3.6/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="/Scripts/jquery-easyui-1.3.6/demo/demo.css" />
    <script type="text/javascript" src="/Scripts/jquery-easyui-1.3.6/jquery.easyui.min.js"></script>
    <script src="/Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <style type="text/css">
        body
        {
            background-color: #F8F8FF;
        }
        
        #main
        {
            position: absolute;
            top: 100px;
            left: 60%;
            width: 400px;
            background-color: #F5FFFA;
        }
        
        #input_text
        {
            position: absolute;
            font-size: 18px;
            width: 390px;
            height: 23px;
            border: 1px solid #C9C9C9;
        }
        .selected
        {
            border: 1px solid #DDD;
            background-color: #F5FFAA;
        }
        
        
        
        .grid
        {
            margin: 0px;
            border-collapse: collapse;
            table-layout: fixed;
        }
        .grid thead td
        {
            border-top: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            border-right: 1px solid #ccc;
            background: url(../Images/column-header-bg.png) repeat-x;
            text-align: left;
            padding: 5px 1px;
            font-weight: normal;
            text-overflow: ellipsis;
            word-break: keep-all;
            overflow: hidden;
            font-weight: bold;
            color: #666;
        }
        .grid tbody tr th
        {
            border-top: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            border-right: 1px solid #ccc;
            background: url(../Images/column-header-bg.png) repeat-x;
            text-align: left;
            padding: 5px 1px;
            font-weight: normal;
            text-overflow: ellipsis;
            word-break: keep-all;
            overflow: hidden;
            font-weight: bold;
            color: #666;
        }
        .grid tbody td
        {
            text-align: left;
            border-bottom: 1px solid #ccc;
            border-right: 1px solid #ccc;
            padding: 1px 1px;
            height: 20px;
            word-break: break-all;
        }
        .grid tbody td .txt
        {
            border: 0px solid #fff;
            font: Verdana, Geneva, sans-serif,宋体;
            padding: 0px;
            height: 22px;
            line-height: 22px;
            width: 100%;
        }
        .grid tbody td .disabled
        {
            background: #F7F7F7;
        }
        .grid tfoot td .txt
        {
            border: 0px solid #fff;
            font: Verdana, Geneva, sans-serif,宋体;
            padding: 0px;
            height: 22px;
            line-height: 22px;
            width: 100%;
        }
        .grid tfoot td
        {
            border-right: 1px solid #ccc;
            background: #FFFDCD;
            text-align: left;
            padding: 3px 1px;
            font-weight: normal;
            text-overflow: ellipsis;
            word-break: keep-all;
            overflow: hidden;
        }
        .grid tbody td .txtselect
        {
            border: 0px solid #fff;
            padding: 0px;
            font: Verdana, Geneva, sans-serif,宋体;
            height: 22px;
            line-height: 22px;
            width: 100%;
        }
        .td-div
        {
            background: #F7F7F7;
            cursor: pointer;
        }
        .tableobj
        {
            margin: 0px;
            border-collapse: collapse;
            table-layout: fixed;
        }
        .tableobj tbody td
        {
            text-align: left;
            border-right: 1px solid #ccc;
            padding: 1px 1px;
            height: 20px;
            word-break: break-all;
        }
        .tableobj tbody .selected
        {
            background-color: #6699cc;
            color: #fff;
        }
        
        /*查询*/
        
        #div_list_query table tbody tr td
        {
            border: 0px;
            border-bottom: 1px solid #ccc;
        }
        #div_list_query table thead th
        {
            border: 0px;
            overflow: hidden;
            background-color: #eee;
            border: 1px solid #ddd;
            font-weight: bold;
        }
        #div_list_query_data
        {
            overflow: auto;
        }
        
        .ComBoxDiv
        {
            scrollbar-arrow-color: #f4ae21; /*三角箭头的颜色*/
            scrollbar-face-color: #333; /*立体滚动条的颜色*/
            scrollbar-3dlight-color: #f5f5f5; /*立体滚动条亮边的颜色*/
            scrollbar-highlight-color: #666; /*滚动条空白部分的颜色*/
            scrollbar-shadow-color: #999; /*立体滚动条阴影的颜色*/
            scrollbar-darkshadow-color: #666; /*立体滚动条强阴影的颜色*/
            scrollbar-track-color: #f5f5f5; /*立体滚动条背景颜色*/
            scrollbar-base-color: #A8A8A8; /*滚动条的基本颜色*/
        }
    </style>
</head>
<body> 
    <div id="main" style=" margin-right:60px;">
        <input type="text" svalue="" stext="" style="width: 200px;" id="dept1" ctrltype="SingleUser"
            entity="V_DataUser" />
        <input type="text" svalue="" stext="" id="Text2" style="width: 200px;" ctrltype="SingleUser"
            entity="V_DataUser" />
        <input type="text" svalue="" stext="" id="dept2" ctrltype="Dept" />
        <input type="text" svalue="" stext="" id="user1" style="width: 200px;" ctrltype="SingleUser"
            entity="V_DataUser" />
        <input type="text" svalue="" stext="" id="Text3" style="width: 200px;" ctrltype="SingleUser"
            entity="V_DataLeaveEmployee" />
        E
        <input type="text" svalue="" stext="" id="Text1" style="width: 400px;" ctrltype="TreeSelect"
            selectmode="m" entity="V_PostData" />
        P----
        <input type="text" svalue="" stext="" id="Text4" ctrltype="TreeSelect" selectmode="s"
            entity="V_PostData" event="SelectPost()" />
        D
        <input type="text" svalue="" stext="" id="Text5" ctrltype="TreeSelect" selectmode="s"
            entity="V_Dept" />
        <input type="text" svalue="" stext="" id="Text7" value="" ctrltype="AutoComplete"
            selectmode="s" entity="V_Dept" filter="DeptPath,name" valuemember="DeptPath"
            displaymember="name" listmember="[{F:'name',W:'150px'},{F:'DeptPath',W:'120px'}]" />
        <input type="text" svalue="" stext="" id="Text8" value="" ctrltype="AutoComplete"
            selectmode="s" entity="V_hrEmployee" filter="EmployeeCode,CName" valuemember="EmployeeCode"
            displaymember="CName" listmember="[{F:'EmployeeCode',W:'150px'},{F:'CName',W:'120px'},{F:'Gender',W:'120px'}]" />
        <input type="text" svalue="" stext="" id="Text9" value="" ctrltype="AutoComplete"
            selectmode="s" entity="V_hrEmployee" filter="EmployeeCode,CName" valuemember="EmployeeCode"
            displaymember="CName" listmember="[{F:'EmployeeCode',W:'150px'},{F:'CName',W:'120px'}]" />
        RRR
        <input type="text" svalue="" stext="" id="Text10" value="" ctrltype="AutoComplete"
            selectmode="s" entity="V_CrmCustomerOrder" filter="Code,OrderAddUserName,CustomerName"
            valuemember="ID" displaymember="CustomerName" listmember="[{F:'Code',W:'150px'},{F:'CustomerName',W:'120px'},{F:'OrderAddUserName',W:'120px'}]" />
        P
        <input type="text" svalue="" stext="" id="Text6" ctrltype="Commbox" selectmode="m"
            entity="V_Dept" filter="DeptPath,name" valuemember="DeptPath" displaymember="name"
            listmember="[{F:'DeptPath',W:'120px'},{F:'name',W:'150px'}]" />
        <input type="text" svalue="" stext="" id="Text11" value="" ctrltype="Commbox" selectmode="s"
            entity="V_hrEmployee" filter="EmployeeCode,CName" valuemember="EmployeeCode"
            displaymember="CName" listmember="[{F:'EmployeeCode',W:'150px'},{F:'CName',W:'120px'}]" />
        <input type="button" value=".." id="btnQuery" />
        <input type="button" value=".." id="Button1" />
        U
        <!--            <input type="text" SValue="" SText="" id="user2" ctrlType="MultiUser"/>-->
    </div>
    <script language="javascript">
        var const_QueryField = "RoleName";
        var const_DataFields = [{ key: 'RoleID', label: 'RoleID', width: 10, sortable: true, resizeable: true }, { key: 'iSun_Selected', label: '', width: 10, formatter: "checkbox" }, { key: 'RoleName', label: '角色名称', width: 100, sortable: true, resizeable: true }, { key: 'Remark', label: '描述', width: 500, sortable: true, resizeable: true}];
        function SelectPost() {
            ///debugger
            ///var _data = fnGetSalaryRecords("HZ24022");
            ///var _date = fnGetEmployeeJoinDate("HZ24022");
            ///alert(encodeURI("D1EEC2B6"));
        }
        //var $=Query=function(){}();
        //alert($("#main>input[id=user2]")[0].tagName);
        //alert($("#main>input[id=user2]").attr('id'));
        //           $("#main>input[id=dept1]").attr('style', "border: 1px solid red");
        //           $("#main>div").attr('style', "border: 1px solid red");
        //           $("#btnQuery").DataQuery(const_QueryField, const_DataFields);
        //           $("#Button1").DataTotal(const_QueryField, const_DataFields);
    </script>


     <div style="clear: both; position:absolute;">
        <div id="DIV_toolbar" style="margin: 0px; padding: 5px;">
            客户名称：
            <input id="cname" type="text" />
            &nbsp; 编号：
            <input id="ccode" type="text" />
            <input type="button" id="searchdatagrid" class="icon-search"  style="width:35px;height:20px; vertical-align:baseline;"  value="" />
        </div>
        <table id="list_data" cellspacing="0" cellpadding="0">
        </table>
        <script type="text/javascript">
            $('#list_data').datagrid({
                title: '应用系统列表',
                iconCls: 'icon-edit', //图标   
                width: 700,
                height: 'auto',
                //nowrap: false,
                //striped: true,
                border: true,
                method: 'get',
                loadMsg: '后台处理中,请稍候...',
                //collapsible: false, //是否可折叠的   
                //fit: true, //自动大小                       
                //url:'/crm/customer/AjaxDepartmentUser.aspx?entity=V_CrmCustomerShow&Action=list',
                url: '/Extend/AjaxData/JSONList.aspx?entity=V_CrmCustomerShow&bindtype=datagrid&pagesize=10',
                //onLoadSuccess: function (data) { debugger; alert(data); },
                //sortName: 'code',   
                //sortOrder: 'desc', 
                columns: [[
                         { field: 'Code', title: '客户Code', width: 100 },
                         { field: 'CustomerName', title: '客户名称', width: 240, editor: 'text' },
                         { field: 'CustomerArea', title: '地址', width: 100, editor: 'text' },
                         { field: 'CustomerType', title: '客户类型', width: 50, editor: { type: 'combobox', options: {
                             valueField: 'PhraseID',
                             textField: 'PhraseText',
                             validType: 'CustomerType',
                             required:true,
                             //editable:false, 
                             onSelect: function (rowData) {
                                 var ed = $('#list_data').datagrid('getEditor', { index: editIndex, field: 'CustomerType' });
                                 var nameVal = rowData.PhraseText;
                                 $(ed.target).combobox('setValue', nameVal);
                                 $('#list_data').datagrid('getRows')[editIndex]['CustomerType'] = nameVal;
                                 $('#list_data').datagrid('getRows')[editIndex]['UnionId'] = rowData.PhraseID;
                             }
                             }
                         }},
                         {field: 'DeptName', title: '部门', width: 80, editor: 'text' },
                         { field: 'action', title: '操作', width: 70, align: 'center', formatter: function (value, row, index) { if (row.editing) { var s = '<a href="#" onclick="saverow(' + index + ')">保存</a> '; var c = '<a href="#" onclick="cancelrow(' + index + ')">取消</a>'; return s + c; } else { var e = '<a href="#" onclick="editrow(' + index + ')">编辑</a> '; var d = '<a href="#" onclick="deleterow(' + index + ')">删除</a>'; return e + d; } } }
                         ]],
                remoteSort: false,
                idField: 'ID',
                singleSelect: true, //是否单选   
                pagination: true, //分页控件   
                rownumbers: true, //行号   
                frozenColumns: [[
                        { field: 'ID', checkbox: true }
                    ]],
                onBeforeEdit: function (index, row) {
                    row.editing = true;
                    $('#list_data').datagrid('refreshRow', index);
                    editcount++;
                },
                onAfterEdit: function (index, row) {
                    row.editing = false;
                    $('#list_data').datagrid('refreshRow', index);
                    editcount--;
                },
                onCancelEdit: function (index, row) { 
                    row.editing = false;
                    $('#list_data').datagrid('refreshRow', index);
                    editcount--;
                },
                onClickRow: function (index, row) { ClickRow(index,row); },
                toolbar: [{
                    text: '增加',
                    iconCls: 'icon-add',
                    handler: addrow
                }, {
                    text: '保存',
                    iconCls: 'icon-save',
                    handler: saveall
                }, {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: cancelall
                }]
            }).datagrid('acceptChanges');

            //var json = { "total": 25, "rows": [{ "ID": "36af29a6-1f19-4cba-96e2-0000be462d6d", "Code": "C0000525988    ", "CustomerName": "佛山市华士康医疗用品有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "--请选择--", "CustomerArea": "佛山区", "ProductCount": "2000万(含)～3000万", "PersonCount": "51人~100人", "UName": "孔小琴", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "系统管理员", "CompanyProduct": "医用输液贴,创口贴,弹力绷带,弹力网状绷带", "DeptName": "信息部", "DetailAddress": "中国广东省佛山市南海区松岗工业城石塘路", "IsValue": "1", "IsPrevate": "2", "UnionId": "", "AreaId": "75bdc4d2-19ed-46cd-ae11-956c08e0484e", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "baa7ce2c-e0b7-4a8f-b0d8-e67cd2d51440", "AddTime": "2013-04-24 16:56", "StatedName": "未保护", "Stated": "0" }, { "ID": "3faf7d81-986b-46d9-8cc6-0000d397fd6a", "Code": "C0000069022    ", "CustomerName": "信阳大庆置业有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "房地产业", "CustomerArea": "信阳", "ProductCount": "5000万(含)～1亿", "PersonCount": "0~50人", "UName": "赵国伟", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "房地产开发", "DeptName": "河南呼叫分部", "DetailAddress": "中国河南省信阳市市辖区北京南路新房集团办公楼", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "84acb1ce-357d-472d-93dc-223ca5b91a19", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "0f198242-c7af-4d84-90bb-2a131dd0e29c", "AddTime": "2012-07-26 17:01", "StatedName": "未保护", "Stated": "0" }, { "ID": "0c6acd05-4344-4e8e-813e-0000d904cbc7", "Code": "C0000202166    ", "CustomerName": "榆阳区方家畔煤矿有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "煤炭开采和洗选业", "CustomerArea": "榆林", "ProductCount": "2000万(含)～3000万", "PersonCount": "201人~500人", "UName": "秦力", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "煤矿", "DeptName": "呼叫分部", "DetailAddress": "中国陕西省榆林市靖边县榆林市靖边县北郊", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "bfddc6f7-ec2f-4392-aea2-a48a963943bf", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "57b14f37-ff8e-44df-9f49-0833a6dbbd02", "AddTime": "2012-09-26 19:36", "StatedName": "未保护", "Stated": "0" }, { "ID": "9347c12c-d92c-41ac-928f-0000dbfd913f", "Code": "C0000097367    ", "CustomerName": "长沙众恒机械制造有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "电气机械及器材制造业", "CustomerArea": "长沙", "ProductCount": "5000万(含)～1亿", "PersonCount": "101人~200人", "UName": "徐金伟", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "机械", "DeptName": "卓越队", "DetailAddress": "中国湖南省长沙市长沙县双江村罗代街", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "85f3a0b8-d0e1-4c3a-b02c-83324f1e4292", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "4fe92bf7-87bb-4ae1-a2f4-3f39a626b367", "AddTime": "2012-08-29 18:07", "StatedName": "未保护", "Stated": "0" }, { "ID": "2a766945-dff5-4b52-8e2a-0000defdd38b", "Code": "C0000175777    ", "CustomerName": "山西临汾摩登铁艺有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "电气机械及器材制造业", "CustomerArea": "临汾市", "ProductCount": "3000万(含)～5000万", "PersonCount": "101人~200人", "UName": "毕成", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "制造", "DeptName": "山西精英队", "DetailAddress": "中国山西省临汾市市辖区山西省临汾市普国装饰北门西侧", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "a965b7aa-3a90-4cd8-b9a5-c6274d517fe3", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "574e5bd4-07a3-4c21-a0c3-882dff261aac", "AddTime": "2012-09-21 17:06", "StatedName": "未保护", "Stated": "0" }, { "ID": "7a1e51bc-e66c-4073-be7d-000196e0558b", "Code": "C0000349823    ", "CustomerName": "深圳市蓝玫瑰珠宝有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "专业技术服务业", "CustomerArea": "福田区", "ProductCount": "1000万(含)～2000万", "PersonCount": "51人~100人", "UName": "陈思", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "科技", "DeptName": "呼叫分部", "DetailAddress": "中国广东省深圳市福田区八卦一路", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "ce14519b-b654-4b7e-925c-3be623e11140", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "06ae8134-0b62-4f00-92ba-85eb08b83c48", "AddTime": "2012-11-25 23:03", "StatedName": "未保护", "Stated": "0" }, { "ID": "55e08dae-b590-443f-a607-00019e58ff8a", "Code": "C0000200483    ", "CustomerName": "原平市聚源液压机械有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "意向客户", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "电气机械及器材制造业", "CustomerArea": "忻州市", "ProductCount": "3000万(含)～5000万", "PersonCount": "201人~500人", "UName": "毕成", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "液压设备", "DeptName": "山西精英队", "DetailAddress": "中国山西省忻州市原平市山西省忻州市原平市大运路上小原平村", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "734f2d90-ba89-4603-92b0-bcce0433f3c0", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "574e5bd4-07a3-4c21-a0c3-882dff261aac", "AddTime": "2012-09-26 17:41", "StatedName": "未保护", "Stated": "0" }, { "ID": "40d31f25-e8ab-40a5-b1f7-0001a483f4d9", "Code": "C0000200820    ", "CustomerName": "湖北弘锦科技有限公司", "Decisionmaker": "AAA", "DecisionPosition": "法人", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "农副食品加工业", "CustomerArea": "孝感", "ProductCount": "3000万(含)～5000万", "PersonCount": "51人~100人", "UName": "董苗苗", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "饲料添加剂", "DeptName": "湖北斗将队", "DetailAddress": "中国湖北省孝感市应城市经济开发区", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "b54fe235-ccef-4685-84ab-8403bc2d419a", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "7e7a1efa-a635-4cfe-805c-1af9ed79a00a", "AddTime": "2012-09-26 17:59", "StatedName": "未保护", "Stated": "0" }, { "ID": "62e896b0-0134-4809-a05d-0001df38e53e", "Code": "C0000098809    ", "CustomerName": "安徽亚林洁具有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "家具制造业", "CustomerArea": "阜阳区", "ProductCount": "1亿(含)～3亿", "PersonCount": "101人~200人", "UName": "张年友", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "洁具生产和销售", "DeptName": "安徽出单队", "DetailAddress": "中国安徽省阜阳市阜南县工业园区", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "403b52fc-43f0-415f-8c1a-f2211902bc28", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "692a0f68-02ad-43bf-abbb-168c6398633a", "AddTime": "2012-08-30 12:42", "StatedName": "未保护", "Stated": "0" }, { "ID": "3af250d8-f090-4c28-923e-00022fcd92e5", "Code": "C0000174207    ", "CustomerName": "杭州萧山大众房屋置换有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "房地产业", "CustomerArea": "杭州区", "ProductCount": "3000万(含)～5000万", "PersonCount": "101人~200人", "UName": "汪建国", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "房地产中介服务", "DeptName": "湖南风云队", "DetailAddress": "中国浙江省杭州市萧山区萧山区城厢街道潘水苑56幢9号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "4b45a2b2-c7b4-4524-81eb-36fa4e6fe3a2", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "49addc22-1ef4-43f5-a8ae-52bc4cbf580b", "AddTime": "2012-09-20 22:10", "StatedName": "未保护", "Stated": "0" }, { "ID": "e92afbeb-2853-4f9c-9ce1-00026883b38d", "Code": "C0000229388    ", "CustomerName": "浏阳市加瑞烟花有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "其他建筑业", "CustomerArea": "长沙", "ProductCount": "3000万(含)～5000万", "PersonCount": "51人~100人", "UName": "王立洋", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "烟花", "DeptName": "雄峰队", "DetailAddress": "中国湖南省长沙市宁乡县23", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "85f3a0b8-d0e1-4c3a-b02c-83324f1e4292", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "00b9e768-ff8b-4586-8dea-1c2064fc2f7c", "AddTime": "2012-10-11 20:03", "StatedName": "未保护", "Stated": "0" }, { "ID": "84fd3bf7-b1b8-4eda-81c9-0002f8c20ae0", "Code": "C0000377931    ", "CustomerName": "中山市石基藤制品有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "木材加工及木、竹、藤、棕、草制品业", "CustomerArea": "中山区", "ProductCount": "2000万(含)～3000万", "PersonCount": "101人~200人", "UName": "谢福强", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "藤制品", "DeptName": "卓越队", "DetailAddress": "中国广东省中山市宏业大街", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "064ddf70-61aa-4f7f-8b3e-b1c7822aed9f", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "ac8168b4-e07a-4a4a-9cde-b269c2b91e1d", "AddTime": "2012-12-07 21:53", "StatedName": "未保护", "Stated": "0" }, { "ID": "8259f405-cfd4-4515-b730-00031eb931ce", "Code": "C0000202428    ", "CustomerName": "浙江讴歌文化投资有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "娱乐业", "CustomerArea": "绍兴区", "ProductCount": "3亿(含)～6亿", "PersonCount": "501人~1000人", "UName": "邹兵", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "休闲娱乐", "DeptName": "铁牛队", "DetailAddress": "中国浙江省绍兴市越城区中兴中路476号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "03131be3-425d-4605-9cca-70dd363cdfc1", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "3fee601d-185b-4fd9-8d36-07df3f94aba9", "AddTime": "2012-09-26 19:47", "StatedName": "未保护", "Stated": "0" }, { "ID": "04239b6c-477d-4b5b-8e5d-000339ef89ee", "Code": "C0000068227    ", "CustomerName": "郑州布瑞克房地产开发有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "房地产业", "CustomerArea": "郑州", "ProductCount": "6亿(含)～10亿", "PersonCount": "201人~500人", "UName": "张小品", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "房地产开发", "DeptName": "河南呼叫分部", "DetailAddress": "中国河南省郑州市中原区桐柏路98号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "f75031fa-8e6d-4677-88ff-e6c179ba2481", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "052c3f8d-f8c5-413e-96d5-53e53649da12", "AddTime": "2012-07-25 12:51", "StatedName": "未保护", "Stated": "0" }, { "ID": "9295ee15-456b-4cc9-b50f-00034f776b36", "Code": "C0000078605    ", "CustomerName": "连云港云泰房地产开发有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "房地产业", "CustomerArea": "连云港区", "ProductCount": "5000万(含)～1亿", "PersonCount": "101人~200人", "UName": "李清梅", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "地产", "DeptName": "博一队", "DetailAddress": "中国江苏省连云港市新浦区银城国际酒店11层", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "3820065e-b9e9-4025-9310-7403d2192020", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "3613f3fd-3728-409d-9457-1f4b7d3c7331", "AddTime": "2012-08-16 17:05", "StatedName": "未保护", "Stated": "0" }, { "ID": "957e586d-ad99-4119-a0ea-00037b4b4dae", "Code": "C0000176121    ", "CustomerName": "山东临沂天一五金工具有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "金属制品业", "CustomerArea": "临沂区", "ProductCount": "3000万(含)～5000万", "PersonCount": "201人~500人", "UName": "蔡土如", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "割草机刀片", "DeptName": "雄鹰队", "DetailAddress": "中国山东省临沂市河东区临沂市河东驻地斜坊工业园", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "08a98e1e-832a-401c-b670-fb41568f941f", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "1f4d2a9c-02f7-4943-8045-c664c166d8e1", "AddTime": "2012-09-21 17:09", "StatedName": "未保护", "Stated": "0" }, { "ID": "de8daa56-e48d-4adb-a950-000391f55ab3", "Code": "C0000170673    ", "CustomerName": "广西横县新凯糖业有限责任公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "农副食品加工业", "CustomerArea": "南宁市", "ProductCount": "5000万(含)～1亿", "PersonCount": "501人~1000人", "UName": "吴杰", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "糖业", "DeptName": "雄峰队", "DetailAddress": "中国广西南宁市横　县广西自治区南宁市横县峦城镇新城街686号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "0dea6b8c-a8c8-484d-a61c-264e9c71fcde", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "7f34bc81-c610-4d0d-b483-63138ca8f34b", "AddTime": "2012-09-20 18:11", "StatedName": "未保护", "Stated": "0" }, { "ID": "a697725f-34f9-458c-b5f5-0003a1518294", "Code": "C0000407805    ", "CustomerName": "内蒙古世纪安达集团有限责任公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "商务服务业", "CustomerArea": "呼和浩特市", "ProductCount": "1亿(含)～3亿", "PersonCount": "1001人~2000人", "UName": "李帅", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "实业", "DeptName": "湖南尖刀连", "DetailAddress": "中国内蒙古呼和浩特市赛罕区呼伦贝尔南路19号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "cc6b95ca-e0f8-4077-b429-70245a86ace7", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "c2e4b5ca-2f6e-40b1-8cac-9e9483b380a1", "AddTime": "2012-12-26 16:17", "StatedName": "未保护", "Stated": "0" }, { "ID": "06a28a44-aff2-47ba-a3e6-0003a8dcb7e5", "Code": "C0000175545    ", "CustomerName": "福建哈特文具有限公司", "Decisionmaker": "AAA", "DecisionPosition": "总经理", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "文教体育用品制造业", "CustomerArea": "福建区", "ProductCount": "3000万(含)～5000万", "PersonCount": "51人~100人", "UName": "徐小梅", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "文具", "DeptName": "信息部", "DetailAddress": "中国福建省福州市晋安区火车站", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "fafe9c93-e9c7-4631-85f7-1a11d66475c0", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "41d7593c-0a9e-49f5-a25c-d619e06af74e", "AddTime": "2012-09-21 14:24", "StatedName": "未保护", "Stated": "0" }, { "ID": "57fa4e84-36c9-40ad-a296-0003d97a9821", "Code": "C0000204295    ", "CustomerName": "忻州新业锻造有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "电气机械及器材制造业", "CustomerArea": "忻州市", "ProductCount": "3000万(含)～5000万", "PersonCount": "101人~200人", "UName": "毕成", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "法兰", "DeptName": "山西精英队", "DetailAddress": "中国山西省忻州市定襄县山西省定襄县崔家工业区", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "734f2d90-ba89-4603-92b0-bcce0433f3c0", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "574e5bd4-07a3-4c21-a0c3-882dff261aac", "AddTime": "2012-09-27 00:15", "StatedName": "未保护", "Stated": "0" }, { "ID": "9d992394-632e-48a9-bbbc-0004206580f7", "Code": "C0000208910    ", "CustomerName": "沈阳天通电力设备有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫中心(分)", "CustomerTrade": "电气机械及器材制造业", "CustomerArea": "沈阳区", "ProductCount": "5000万(含)～1亿", "PersonCount": "101人~200人", "UName": "李帅", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "变压器", "DeptName": "沈阳中星队", "DetailAddress": "中国辽宁省沈阳市苏家屯区迎春街219号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "c10669e4-96be-4eb1-b706-0d8d65bdb41f", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "0599a1eb-636e-4ff4-b1ff-2b30824224ff", "AddTime": "2012-09-28 11:30", "StatedName": "未保护", "Stated": "0" }, { "ID": "68afeeb5-b7f4-4258-8e58-00043cdb639d", "Code": "C0000392886    ", "CustomerName": "眉山市东坡区晶鑫化工厂", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "化学原料及化学制品制造业", "CustomerArea": "眉山市", "ProductCount": "3000万(含)～5000万", "PersonCount": "51人~100人", "UName": "吕洁", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "化工", "DeptName": "信息部", "DetailAddress": "中国四川省眉山市东坡区富牛镇", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "04cfc731-4d3e-45d0-964d-63f6ec14240c", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "d72d8b45-006c-4bba-b3c7-e394dea97e5e", "AddTime": "2012-12-17 11:01", "StatedName": "未保护", "Stated": "0" }, { "ID": "c290f0e2-2730-4a4f-bb27-0004604a84d4", "Code": "C0000466914    ", "CustomerName": "东莞市广纳家具制造有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "家具制造业", "CustomerArea": "东莞区", "ProductCount": "1亿(含)～3亿", "PersonCount": "501人~1000人", "UName": "张君丽", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "家具", "DeptName": "信息部", "DetailAddress": "中国广东省东莞市大朗镇乌石岭村", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "eb3b24cd-4ce6-41af-81cf-556d52ad971e", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "d1fb7c13-fd05-4e27-b779-8c2b93249c1e", "AddTime": "2013-02-28 13:57", "StatedName": "未保护", "Stated": "0" }, { "ID": "9070cec3-a886-4a20-82f3-000483b8b8ec", "Code": "C0000094866    ", "CustomerName": "湖南永健汽车贸易有限公司", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "城市公共交通业", "CustomerArea": "郴州", "ProductCount": "3000万(含)～5000万", "PersonCount": "101人~200人", "UName": "徐金伟", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "汽车贸易", "DeptName": "卓越队", "DetailAddress": "中国湖南省郴州市市辖区七里大道15号", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "4d341cb3-63d0-4df1-a891-1ffcc1aa28e0", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "4fe92bf7-87bb-4ae1-a2f4-3f39a626b367", "AddTime": "2012-08-28 18:01", "StatedName": "未保护", "Stated": "0" }, { "ID": "33ddda2a-0def-476c-9c49-0004b3cfd730", "Code": "C0000474256    ", "CustomerName": "广东省韶关市化工厂", "Decisionmaker": "AAA", "DecisionPosition": "董事长", "CustomerType": "x", "CustomerLevel": "普通", "CustomerOrigin": "呼叫开发(总)", "CustomerTrade": "化学原料及化学制品制造业", "CustomerArea": "韶关区", "ProductCount": "5000万(含)～1亿", "PersonCount": "201人~500人", "UName": "杨磊2", "ProductSum": "0", "ProductSum2": "0", "ProductSum3": "0", "SaleadName": "", "CompanyProduct": "颜料钛白粉;非颜料用钛白粉;金红石型陶瓷钛白粉;工业硫酸;蓄电池酸;精制硫酸;过磷酸钙;硫酸亚铁;饲料级硫酸亚铁;造纸专用钛白粉;", "DeptName": "信息部", "DetailAddress": "中国广东省韶关市浈江区东郊黄金村", "IsValue": "1", "IsPrevate": "0", "UnionId": "", "AreaId": "0fd5ec5b-05b0-49a6-a501-7fb17b8a1141", "CompanyNetting": "", "DecisionTel": "13556839807", "DecisionTel2": "", "IsHistory": "0", "AddUser": "f386c63e-0a4c-4f86-a54d-86854a7aa5d8", "AddTime": "2013-03-07 14:07", "StatedName": "未保护", "Stated": "0"}] };
            //$('#list_data').datagrid('loadData', json);  

            //设置分页控件   
            var p = $('#list_data').datagrid('getPager');
            $(p).pagination({
                pageSize: 10, //每页显示的记录条数，默认为10   
                pageList: [10,15,20,35,40,60], //可以设置每页记录条数的列表   
                beforePageText: '第', //页数文本框前显示的汉字   
                afterPageText: '页    共 {pages} 页',
                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
                /*onBeforeRefresh:function(){  
                $(this).pagination('loading');  
                alert('before refresh');  
                $(this).pagination('loaded');  
                }*/
            });

            $('#DIV_toolbar').appendTo('.datagrid-toolbar');

            function QueryData() {
                var cn = $("#cname").val();
                var co = $("#ccode").val();
                var condition = "";
                if (cn != "") {
                    condition += " CustomerName like '%" + cn + "%'";
                }
                if (co != "") {
                    condition += ((condition != "" ? " and" : "") + " Code like '%" + co + "%'");
                }
                $("#list_data").datagrid("load", {
                    "customCondition": condition
                });
            }

            var editcount = 0;
            var editIndex = undefined;

            function ClickRow(index, row) {
               if (editIndex != index) {
                   if (editIndex != undefined) saverow(editIndex); else cancelrow(editIndex);
                    $('#list_data').datagrid('selectRow', index).datagrid('beginEdit', index);
                    editIndex = index;
                    $("#list_data").datagrid('unselectAll');
                } else {
                    $('#list_data').datagrid('selectRow', editIndex); 
                }
                synCustomerType(index,row)
            }

            function synCustomerType(rowIndex, rowData) {;
                var url = '/Extend/AjaxData/JSONList.aspx?entity=DatPhraseDetail&bindtype=datagrid&page=0&customCondition=ClassID=\'C4A646C4-FE1A-4F6D-80E1-0FBF42CC3B0B\'';
                var ed = $('#list_data').datagrid('getEditor', { index: rowIndex, field: 'CustomerType' });
                $.ajax({
                    url: url,
                    dataType: 'json',
                    type: 'POST',
                    success: function (data) { 
                        $(ed.target).combobox('loadData', data.rows);
                    }
                });
            }

//            function ComboxSelect(index) {
//                if (editIndex == undefined) { return true }
//                if ($('#list_data').datagrid('validateRow', index)) {
//                    var ed = $('#list_data').datagrid('getEditor', { index: index, field: 'CustomerType' });
//                    var nameVal = $(ed.target).combobox('getText');
//                    $(ed.target).combobox('setValue', nameVal);
//                    $('#list_data').datagrid('getRows')[index]['CustomerType'] = nameVal;
//                    $('#list_data').datagrid('endEdit', index);
//                }
//            }

            function editrow(index) { $('#list_data').datagrid('beginEdit', index); }
            function deleterow(index) { $.messager.confirm('确认', '是否真的删除?', function (r) { if (r) { $('#list_data').datagrid('deleteRow', index); } }); }
            function saverow(index) { $('#list_data').datagrid('endEdit', index); }
            function cancelrow(index) { $('#list_data').datagrid('cancelEdit', index); }
            function addrow() { 
                if (editcount > 0) { $.messager.alert('警告', '当前还有' + editcount + '记录正在编辑，不能增加记录。'); return; } 
                $('#list_data').datagrid('appendRow',
            { ID: '', CustomerName: '',CustomerType:'', CustomerArea: '', DeptName: ''});
            }
            function saveall() { 
                if ($('#list_data').datagrid('getChanges').length) {
                    var inserted = $('#list_data').datagrid('getChanges', "inserted");
                    var deleted = $('#list_data').datagrid('getChanges', "deleted");
                    var updated = $('#list_data').datagrid('getChanges', "updated");

                    var effectRow = new Object();
                    effectRow["inserted"] = "", effectRow["deleted"] = "", effectRow["updated"] = ""; 
                    if (inserted.length) {
                        effectRow["inserted"] = $.toJSON(inserted);
                    }
                    if (deleted.length) {
                        effectRow["deleted"] = $.toJSON(deleted);
                    }
                    if (updated.length) {
                        effectRow["updated"] = $.toJSON(updated);
                    }

                    var datajson = { dbadd: encodeURI(effectRow["inserted"],"utf-8"), dbupdate: encodeURI(effectRow["updated"],"utf-8"), dbdel: encodeURI(effectRow["deleted"],"utf-8") };

                    $.post("/crm/customer/AjaxDepartmentUser.aspx?entity=V_CrmCustomerShow&Action=aud", datajson, function (rsp) { 
                        if (rsp.Staute == "Success") {
                            $.messager.alert("提示", "提交成功！");
                            $('#list_data').datagrid('acceptChanges');
                        }
                        else {
                            $.messager.alert("提示", rsp.Msg);
                        }
                    }, "json").error(function () {
                        $.messager.alert("提示", "提交错误了！");
                    });
                } 
            } // $('#list_data').datagrid('acceptChanges'); //执行这个语句，将清理所有的修改状态
            function cancelall() { $('#list_data').datagrid('rejectChanges'); }
 
        </script>
    </div>
</body>
</html>
